package com.iweb.io;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.time.LocalDateTime;

public class IoClient {
    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            new Thread(() -> {
                try {
                    Socket socket = new Socket("127.0.0.1", 9000);
                    while (true) {
                        OutputStream out = socket.getOutputStream();
                        out.write(LocalDateTime.now().toString().getBytes());
                        out.flush();
                        Thread.sleep(1000);
                    }
                } catch (IOException | InterruptedException e) {
                    e.printStackTrace();
                }
            }).start();
        }
    }
}
